package me.tuyou.jvm.book;

/**
 * 测试对象相互引用对象照样可以回收掉
 * -verbose:gc -XX:+PrintHeapAtGC
 * @author：涂有
 * @date 2017年9月9日 下午1:33:05
 */
public class RefEachOther {

	public RefEachOther instance;
	private static final int _1MB = 1024 * 1024;
	private byte[] bigSize = new byte[2 * _1MB];
	
	public static void main(String[] args) {
		
		RefEachOther one = new RefEachOther();
		RefEachOther two = new RefEachOther();
		one.instance = two;
		two.instance = one;
		
		//对象附null方便gc回收
		one = null;
		two = null;
		
		System.gc();
	}
}
